/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Facade;

import Modelo.DaoAgendaFactory;
import Modelo.DaoAgendaInterface;
import VO.AgendaVO;
import java.util.Vector;
import javax.management.InstanceNotFoundException;
import utiles.exceptions.DataException;

/**
 *
 * @author Jorge
 */
public class AgendaFacade
{
    public boolean addContacto(AgendaVO nuevo)throws Exception, DataException, InstanceNotFoundException
    {
        DaoAgendaInterface dao  = (DaoAgendaInterface)DaoAgendaFactory.getDAO();
        boolean resultado = dao.ingresarContacto(nuevo);

        return resultado;
    }
     public boolean editContacto(AgendaVO nuevo)throws Exception, DataException, InstanceNotFoundException
    {
        DaoAgendaInterface dao  = (DaoAgendaInterface)DaoAgendaFactory.getDAO();
        boolean resultado = dao.editarContacto(nuevo);

        return resultado;
    }
      public boolean borrarContacto(String nombre)throws Exception, DataException, InstanceNotFoundException
    {
        DaoAgendaInterface dao  = (DaoAgendaInterface)DaoAgendaFactory.getDAO();
        boolean resultado = dao.eliminarContacto(nombre);

        return resultado;
    }
     public Vector cargarContactos()throws Exception, DataException, InstanceNotFoundException
    {
        DaoAgendaInterface dao  = (DaoAgendaInterface)DaoAgendaFactory.getDAO();
        Vector resultado = dao.cargarContactos();

        return resultado;
    }
      public AgendaVO cargarContacto(String id)throws Exception, DataException, InstanceNotFoundException
    {
        DaoAgendaInterface dao  = (DaoAgendaInterface)DaoAgendaFactory.getDAO();
        AgendaVO resultado = dao.cargarContacto(id);

        return resultado;
    }
 public Vector cargarDatosContactos()throws Exception, DataException, InstanceNotFoundException
    {
        DaoAgendaInterface dao  = (DaoAgendaInterface)DaoAgendaFactory.getDAO();
        Vector resultado = dao.mostrarContactos();

        return resultado;
    }


}
